<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>WebTranslateIt – Admin</title>
    <link rel="stylesheet" href="<%= base_path %>/static/main.css" type="text/css" media="screen" charset="utf-8">
  </head>
  <body>
    <div id="content">
      <h1>WebTranslateIt – Admin</h1>
      <div>
        <p>
          Manage your translations on <a href="https://webtranslateit.com">webtranslateit.com</a>
          and use the interface below to update the local version.
          Once you are finished, any uncommitted files will need to be updated and committed by a developer.
        </p>

        <% files.each do |file| %>
          <table>
            <caption> <%= file.file_path %> </caption>
            <thead>
              <tr>
                <th>Locale</th>
                <td>Path</td>
                <td>Exists</td>
                <td>Committed</td>
                <td>New Version Available</td>
              </tr>
            </thead>
            <tbody>
              <% locales.each do |locale| locale_file = file.for(locale) %>
                <tr>
                  <th style="width: 5px;"><%= locale %><%= " (master)" if locale_file.master? %></th>
                  <td><abbr title="<%= locale_file.file_path %>"><%= File.basename(locale_file.file_path) %></abbr></td>
                  <td><%= highlight_unless_equal(locale_file.exists?, true) %></td>
                  <td><%= highlight_unless_equal(locale_file.committed?, true) %></td>
                  <td><%= highlight_unless_equal(locale_file.modified_remotely?, false) %></td>
                </tr>
              <% end %>
            </tbody>
          </table>
        <% end %>

        <form method="post" action="<%= base_path %>/update">
          <input type="submit" value="Update All Translations" />
        </form>

        <form method="post" action="<%= base_path %>/upload">
          <input type="submit" value="Upload Master File" onclick="javascript: return confirm('This will immediately make new required translations available on webtranslateit.com. Are you sure you with to continue?')" />
        </form>
      </div>
    </div>
    <div id="footer">
      <p>This page was generated by <a href="http://github.com/cwninja/rack-webtranslateit">rack-webtranslateit</a>, developed by <a href="http://tomlea.co.uk">Tom Lea</a> at <a href="http://www.reevoo.com/">reevoo.com</a>.</p>
    </div>
  </body>
</html>
